#!/bin/bash

echo "===========自动化安装Hadoop==========="

echo "系统要求1.安装了docker 2安装了docker-compose"

read -r -p "准备好了吗? [Y/n] " envConfirm
case $envConfirm in
    [yY][eE][sS]|[yY])
		echo "Yes 继续执行"
		;;
    [nN][oO]|[nN])
		echo "No 终止执行"
		exit 1
       	;;
    *)
		echo "Invalid input... 终止执行"
		exit 1
		;;
esac

if [  -d "$PWD/data/" ];then
    sudo rm -rf $PWD/data
fi

mkdir -p $PWD/data/

cd centos-hadoop

docker build -t centos/hadoop .

cd -

docker-compose -f docker-compose-centos.yml up -d

echo "集群构建成功"